<!DOCTYPE html> 
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"> 

<h:head>
	<h:outputStylesheet library="css" name="bootstrap.css"  />
	<h:outputStylesheet library="css" name="starter-template.css"  />
	<h:outputScript library="js" name="bootstrap.js" />
	<meta charset="utf-8"/>
</h:head> 

<body> 
	<ui:include src="menu.xhtml" />
	
	<div class="container">
    	<div class="collapse navbar-collapse">
          <ul class="nav navbar-nav">
             <li>
	        	<h:form>
		    		<h:link outcome="createDespacho.xhtml" value="Alta Despacho" styleClass="navbar-brand"/>
		    	</h:form>
            </li>
            <!-- 
            <li>
	        	<h: form>
		    		<h :link outcome="deleteDespacho.xhtml" value="Eliminar Despacho" styleClass="navbar-brand"/>
		    	</h :form>
		     	
            </li>
            -->
          </ul>
        </div> <!-- collpase navbar-collpase -->
        
		 <h1>Módulos Despacho disponibles</h1>
		 <h:dataTable value="#{configController.despachos}" var="despacho" border="1" styleClass="table">
			<h:column>
				<f:facet name="header"> <h:outputText value="ID" /></f:facet>
				<h:outputText value="#{despacho.idModulo}" />
			</h:column>
			
			<h:column>
				<f:facet name="header"> <h:outputText value="Dirección IP" /> </f:facet>
				<h:outputText value="#{despacho.ipAddress}" />
			</h:column>
			
			<h:column>
				<f:facet name="header"> <h:outputText value="Descripción" /> </f:facet>
				<h:outputText value="#{despacho.descripcion}" />
			</h:column>		

			<h:column>
				<form action="eliminarModulo" method="post">
					<f:facet name="header"> <h:outputText value="Eliminar" /> </f:facet>
					<input type="hidden" value="#{despacho.idModulo}" name="moduloId"/>
					<input type="hidden" value="despacho" name="modulo"/>
					
					<button type="submit" class="btn btn-default">
					  <span class="glyphicon glyphicon-remove-circle"></span> Eliminar
					</button>					
				</form>
			</h:column>		
						
		</h:dataTable>
		        
	</div> <!-- container -->	
</body>
</html>